import React from 'react';
import Modal from 'antd/lib/modal/Modal';
import { columns } from '@/constants/constants';
import { IAllProps } from '@/typings/types';
import { Table } from 'antd';

interface IProps {
  visible: boolean;
  onCancel: () => void;
  onOk: (values: IAllProps) => void;
  dataSource?: IAllProps[];
}

const SelectClassWindow: React.FC<IProps> = (props) => {
  const { visible, dataSource, onCancel, onOk } = props;

  const handleSelect = () => {
    onOk({});
  };

  return (
    <Modal
      visible={visible}
      onCancel={onCancel}
      onOk={handleSelect}
      cancelText="取消"
      okText="保存"
    >
      <Table columns={columns} dataSource={dataSource} />
    </Modal>
  );
};

export default React.memo(SelectClassWindow);
